1. Field of the Invention
One or more embodiments of the present invention relate to a method, medium, and system rendering 3-dimensional (3D) graphic data, and more particularly, to a rendering method, medium, and system improving the picture quality of a transparent object when the transparent object is included in input 3D graphic data.
2. Description of the Related Art
Portions of objects included in 3D graphic data may overlap each other depending, on the viewpoint in a 3D space from which 3D objects are viewed. If an opaque object is closer to a projected originating position of the viewpoint, from among the overlapping objects, i.e., positioned in front of other objects when viewed from the screen, portions of objects positioned behind of this opaque object are covered by the opaque object, and thus the covered portions should not be displayed on the screen.
Accordingly, in order to only display objects that are designed to be seen from the viewpoint, a rendering device for rendering 3D graphic data performs a depth test, e.g., by using a depth buffer storing depth values of pixels forming the screen. The depth test is a process for determining whether or not the depth value of a currently rendered object is closer to the screen, i.e., the viewpoint, than the depth value already stored in the depth buffer when it is seen from the particular viewpoint. If the depth test is successful, that is, if the depth value of the currently rendered object represents a depth closer to the screen than the depth value stored in the depth buffer, the rendering device updates the depth value of the depth buffer with the depth value of the current rendered object. Then, the rendering device updates the color values of a frame buffer storing the color values of pixels forming the screen, with the color value of the currently rendered object, corresponding to the update of the depth value of the depth buffer. The update of the depth buffer means that the depth test of the currently rendered object is successful, i.e., that the currently rendered object is closer to the viewpoint and in front of a previously rendered object when looking at the screen. Accordingly, in order to display the currently rendered object on the screen, the color value of the frame buffer is updated with the color value of the currently rendered object.
However, when a transparent object is included in input 3D graphic data, and if an object positioned in front between two objects overlapping each other on the screen is the transparent object and the object positioned at the back is an opaque object, an error may occur in the rendering of the objects because of the rendering order of the objects, thereby degrading the picture quality by incorrectly rendering the graphic data.
FIG. 1 is a reference diagram showing how a rendering error occurs because of the rendering order if a transparent object is included in 3D graphic data. As illustrated in FIG. 1, two triangles 100 and 110 may be displayed on a screen, overlapping each other when they are seen from a particular viewpoint. The triangle 100, positioned in front, is a transparent blue triangle and the triangle 110, positioned behind the triangle 100, is an opaque red triangle. In this case, according to the rendering order of the two triangles 100 and 110, a rendering error may occur.
Here, if the opaque triangle 110 is first rendered and then the transparent triangle 100 is rendered, when the opaque triangle 110 is rendered, the depth buffer and the frame buffer are updated according to the result of rendering. If the transparent triangle 100 is then rendered, the depth value of the opaque triangle 110 stored in the depth buffer is updated with the depth value of the transparent triangle 100 because the depth value of each pixel forming the transparent triangle 100 is less than the depth value of each pixel forming the opaque triangle 110, i.e., because the transparent triangle 100 is closer to the view point. Thus, corresponding to this update, the color value of the opaque triangle 110 stored in the color buffer is updated with a color that is seen when the opaque red triangle 110 is seen through the transparent blue triangle 100, for example, a violet color, by referring to the color value and transparency of the triangle 100.
However, if the front triangle 100 is first rendered and then the rearward opaque triangle 110 is rendered, the depth value of each pixel forming the opaque triangle 110 is greater than the depth value of each pixel forming the transparent triangle 100, and thus the depth buffer is not updated and, corresponding to this, neither is the color buffer. Accordingly, in this case, only the transparent blue triangle is displayed on the screen, thereby causing a rendering error.
In order to solve this, a technique has been designed in which objects included in 3D graphic data are rendered in an order of decreasing distances from a viewpoint at which the 3D objects are seen in a 3D space. However, even according to this technique, the rendering order among objects is determined according to the distance from the center or centroid of an object and a viewpoint. If a transparent object included in the 3D graphic data overlaps another object in a 3D space, rendering errors will again occur.
For example, according to this technique, if object A and object B overlap in a 3D space and the center of object A is closer to a viewpoint than the center of object B, object A is rendered earlier than object B. Accordingly, the pixels of object B positioned behind the pixels of object A will not be displayed on the screen. That is, since the depth buffer is updated with the pixel values of object A, the pixels of object B having depth values greater than the depth values stored in the depth buffer will not be considered. If object A is an opaque object, as noted above, this should not cause a problem. However, if object A is a transparent object, even though object B is positioned behind object A, object B should preferably be displayed on the screen through object A, but according to the rendering order, the aforementioned rendering error occurs.
Thus, as described above, if a transparent object included in 3D graphic data overlaps another object in a 3D space, even though the objects are rendered in the order of decreasing distance between an object and a viewpoint, a rendering errors still occur, thereby degrading the picture quality.